package com.wft.singleton;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public enum  Test04Enum {
   INSTANCE;
    public Test04Enum getInstance(){
        return INSTANCE;
    }

    public static void main(String[] args) throws IllegalAccessException, InstantiationException, NoSuchMethodException, InvocationTargetException {
//        System.out.println(Test04Enum.getInstance().hashCode());
//        System.out.println(Test04Enum.getInstance().hashCode());


//        Test04Enum test04Enum = Test04Enum.class.newInstance();
//        System.out.println(test04Enum);

        // IllegalArgumentException: Cannot reflectively create enum objects
        Constructor<Test04Enum> declaredConstructor = Test04Enum.class.getDeclaredConstructor(String.class, int.class);
        declaredConstructor.setAccessible(true);
        declaredConstructor.newInstance("XXX",1);

    }
}
